Field of the Invention
The present invention relates to an image processing apparatus and an image processing method, and particularly relates to a motion vector detection technique.
Description of the Related Art
As a method for detecting a motion vector between images, a template matching method is known. The template matching method is a method for setting a partial area of one image as a template image, searching for a partial area in another image whose correlation with the template image is largest, and detecting the difference between the positions of the partial areas as a motion vector (Japanese Patent Laid-Open No. 2003-224854). In some cases, the search range is limited, or a plurality of template images are used.
In Japanese Patent Laid-Open No. 2003-224854, the correlation between image areas is evaluated based on the magnitude of an SAD (Sum of Absolute Differences), and an area whose SAD with the template image is smallest is searched for. In addition, the degree of reliability of the detected motion vector is determined based on the magnitude relationship between the SAD and a plurality of predetermined threshold values.
However, in the case where there is a difference in the degree of bokeh between images as in the case where in-focus distances are different or the in-focus position varies between images, a correlation evaluation value that is based on the difference between pixel values such as an SAD is larger as a whole than in the case where there is no difference in the degree of bokeh. Therefore, if the degree of reliability of the motion vector is evaluated based on the magnitude relationship between the correlation evaluation value and fixed threshold values, there is a risk that the degree of reliability is determined to be lower than the actual degree of the reliability.